/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import java.awt.CardLayout;
import javax.swing.JPanel;
import webbank.DatabaseHandler;

/**
 *
 * @author Johan
 */
public class MainPanel extends JPanel{
    public static final String LOGINPANEL = "LoginPanel";
    public static final String USERPANEL = "UserPanel";
    private UserPanel userPanel;
    private LoginPanel loginPanel;
    CardLayout cl;
    public DatabaseHandler dbHandler;
    
    public MainPanel(){
        setLayout(new CardLayout());
        dbHandler = new DatabaseHandler();
        userPanel = new UserPanel(this);
        loginPanel = new LoginPanel(this);
        add(userPanel,USERPANEL);
        add(loginPanel, LOGINPANEL);
        cl = (CardLayout) getLayout();
        cl.show(this, LOGINPANEL);
    }
    public void swapScreen(String panel){
        cl = (CardLayout) getLayout();
        cl.show(this,panel);
    }
    public void setCurrentUser(String civicReg){
        userPanel.setCurrentCivicReg(civicReg);
        userPanel.getAccounts();
    }
}
